#ifndef BATTERY_LEVEL_CHECK_H
#define BATTERY_LEVEL_CHECK_H

#include "task/sync_request_task.h"
#include <unistd.h>
#include "task/task_factory.h"
#include "robot_pose.h"

class BatteryLevelCheck: public task::SyncRequestTask
{
public:
    explicit BatteryLevelCheck(const std::string &name)
        : task::SyncRequestTask(name)
    {
    }
    ~BatteryLevelCheck() override
    {
        EASE_INFO("~BatteryLevelCheck");
    }
    bool onStart() override
    {
        static int count = 0;
        if (count++ < 3)
        {
            EASE_INFO("name: %s, battery more than 30", task_name_.c_str());
            return true;
        }
        else
        {
            EASE_INFO("name: %s, battery less than 30", task_name_.c_str());
            count = 0;
            return false;
        }
    }

    void onDone(bool res) override
    {
//        EASE_INFO("name: %s done, res: %s", task_name_.c_str(), res ? "pass" : "fail");
    }
};

#endif //BATTERY_LEVEL_CHECK_H
